package cn.iocoder.yudao.module.member.api.config;

import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.member.api.config.dto.UserPoolConfigRespDTO;
import cn.iocoder.yudao.module.member.controller.admin.siteconfig.vo.UserPoolConfigVo;
import cn.iocoder.yudao.module.member.service.siteconfiguration.UserPoolConfigService;
import com.google.common.collect.Lists;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author liujq
 * @date 20241119 0:52
 */
@Service
public class UserPoolConfigApiImpl implements UserPoolConfigApi {

    @Resource
    private UserPoolConfigService userPoolConfigService;
    @Override
    public List<UserPoolConfigRespDTO> getConfig() {
        List<UserPoolConfigVo> configVos = userPoolConfigService.getConfig();
        if(CollectionUtil.isEmpty(configVos)){
            return Lists.newArrayList();
        }

        return BeanUtils.toBean(configVos, UserPoolConfigRespDTO.class);
    }
}
